package ldh.im.client.validate;

public class ParamCheckUtil {

    public static void notNull(String param) {
        if (param == null) {
            throw new RuntimeException("参数为空");
        }
    }

    public static void notNull(String param, String errorMsg) {
        if (param == null) {
            throw new RuntimeException(errorMsg);
        }
    }

    public static void notNull(Object param) {
        if (param == null) {
            throw new RuntimeException("参数为空");
        }
    }

    public static void notNull(Object param, String errorMsg) {
        if (param == null) {
            throw new RuntimeException(errorMsg);
        }
    }

    public static void notEmpty(String param) {
        if (param == null || param.trim().equals("")) {
            throw new RuntimeException("参数为空");
        }
    }

    public static void notEmpty(String param, String errorMsg) {
        if (param == null || param.trim().equals("")) {
            throw new RuntimeException(errorMsg);
        }
    }

    public static void isTrue(boolean isTrue) {
        if (!isTrue) {
            throw new RuntimeException("参数错误");
        }
    }

    public static void isTrue(boolean isTrue, String errorMsg) {
        if (!isTrue) {
            throw new RuntimeException(errorMsg);
        }
    }

}
